/*******************************************************************************************
 *  Direction.c
 *
 *  Creating and managing Direction object structures.
 *
 *******************************************************************************************/







/*******************************************************************************************
 *  INCLUDES :
 *******************************************************************************************/

/* System and library related : */
#include <stdlib.h>
#include <string.h>

/* Project related : */
#include "Direction.h"







/*******************************************************************************************
 *  FUNCTIONS :
 *******************************************************************************************/

/*******************************************************************************************
 *  NEWDIRECTION : Creates an empty Direction object structure.
 *******************************************************************************************/
Direction *newDirection(void) {
	Direction *d;

	/* Creating the container structure : */
	d = (Direction *)malloc(sizeof(Direction));


	/* Setting the object's type : */
	d->otype = direction;


	/* Returning the still empty structure : */
	return d;

}




/*******************************************************************************************
 *  FREEDIRECTION : destroys a Direction object structure and all the objects it stores.
 *******************************************************************************************/
void freeDirection(Direction *d) {

	free(d->value);			/* Free the value string.  */
	free(d);				/* Free the object itself. */

}




/*******************************************************************************************
 *  SETDIRECTIONTYPE : sets the Direction object's type of acceleration.
 *******************************************************************************************/
void setDirectionType(Direction *d, DirType t) {
	d->type = t;
}



/*******************************************************************************************
 *  SETDIRECTIONVALUE : sets the Direction object's acceleration value.
 *******************************************************************************************/
void setDirectionValue(Direction *d, char *value) {
	d->value = value;
}
